package com.cowin.inf.controller;
import com.cowin.base.result.Result;
import com.cowin.base.result.ResultGenerator;
import com.cowin.base.BaseController;
import com.cowin.inf.model.KyUptimeRate;
import com.cowin.inf.model.vo.KyUptimeRateVo;
import com.cowin.inf.service.KyUptimeRateService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Resource;
import java.util.List;

/**
 * Created by  on 2019/09/24.
 * @author CodeGenerator
 */
@Slf4j
@RestController
@Api(value = "KyUptimeRateController", description = "开动率控制器", tags = "KyUptimeRateController", consumes = "application/json")
@RequestMapping("/ky/uptime/rate")
public class KyUptimeRateController extends BaseController<KyUptimeRate> {
    @Resource
    private KyUptimeRateService kyUptimeRateService;

    @ApiOperation(value = "开动率日志查询过滤", notes = "开动率日志查询过滤")
    @PostMapping("/search")
    public Result searchUptimeRate(@RequestBody KyUptimeRateVo kyUptimeRateVo) {
        PageHelper.startPage(kyUptimeRateVo.getPage(), kyUptimeRateVo.getLimit());
        List<KyUptimeRate> list = kyUptimeRateService.searchUptimeRate(kyUptimeRateVo);
        PageInfo<KyUptimeRate> pageInfo = new PageInfo<>(list);
        return ResultGenerator.genSuccessResult(pageInfo);
    }
}
